<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%String contextRoot = request.getContextPath();%>
<f:loadBundle basename="properties.messages" var="msg"/>
<f:view>
<!doctype html>
<html>
<head>
	<%@ include file="include/meta.jsp" %>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>SISDEP : Sistema de Informaci<h:outputText value="#{msg.tilde_o}" />n de Espacio P<h:outputText value="#{msg.tilde_u}" />blico</title>
	<meta name="description" content="">
	<meta name="author" content="">
	<link rel="stylesheet" href="<%=contextRoot%>/css/validationEngine.jquery.css" type="text/css"> <!-- Del validador de formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/normalize.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/uniform.css"> <!-- estilos formularios -->
	<link rel="stylesheet" href="<%=contextRoot%>/css/cuerpo.css">
	<link rel="stylesheet" href="<%=contextRoot%>/css/richCustom.css">
</head>
<body>
<div id="marco"> <!--inicio contenedor --> 
<div class="arriba-cuerpo"></div> <!-- Burrada pa ver borde redondo en IE -->
<div class="cuerpo">
<a href="<%=contextRoot%>/index.jsf"><img src="<%= contextRoot %>/images/logos.png" /></a>
<div class="clear"></div>
<!-- Menu y Usuario init() -->
	<%@ include file="include/menuUsuario.jsp" %>
<!-- Menu y Usuario end() -->
<div class="clear"></div>
<!-- Formulario -->
<div id="buscador">
<h2>Gesti<h:outputText value="#{msg.tilde_o}" />n de Art<h:outputText value="#{msg.tilde_i}" />culo: <h:outputText value="#{articuloController.articulo.id ne '' ? 'NUEVO' : 'EDICION'}" /></h2>
<h:form id="createArticuloForm">
		<span class="left" style="margin-left:0px;">
		<label>C<h:outputText value="#{msg.tilde_o}" />digo <span class="asterisco">*</span></label>
				<h:inputText id="codigo" size="4" maxlength="4" styleClass="validate[required]"
						value="#{articuloController.articulo.codigo}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Descripci<h:outputText value="#{msg.tilde_o}" />n <span class="asterisco">*</span></label>
				<h:inputText id="descripcion" size="60" maxlength="128" styleClass="validate[required]"
						value="#{articuloController.articulo.descripcion}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Descripci<h:outputText value="#{msg.tilde_o}" />n adicional </label>
				<h:inputTextarea
					id="descripcionAdicional" cols="40" rows="3" styleClass=""
					style="width:350px !important; min-width:350px !important; max-width:350px !important; height:60px !important; min-height:60px !important; max-height:60px !important;"
					value="#{articuloController.articulo.descripcionAdicional}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Unidad de medida <span class="asterisco">*</span></label>
			<h:selectOneMenu id="idUnidadMedida" styleClass="validate[required]" value="#{articuloController.articulo.idUnidadMedidaStr}">
            	<f:selectItem itemLabel="Seleccione..." itemValue=""/>
                <f:selectItems value="#{masterListCache.measureUnitType}"/>
            </h:selectOneMenu>
		</span>
		<span class="left" style="margin-left:40px">
		<label>Peso aproximado (Kg)<span class="asterisco">*</span></label>
				<h:inputText id="peso" size="15" maxlength="15" styleClass="validate[required]"
						value="#{articuloController.articulo.peso}" />
		</span>
		<span class="left" style="margin-left:40px">
		<label>Volumen aproximado (m. c<h:outputText value="#{msg.tilde_u}" />bico)<span class="asterisco">*</span></label>
				<h:inputText id="volumen" size="15" maxlength="15" styleClass="validate[required]"
						value="#{articuloController.articulo.volumen}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Grupo Art<h:outputText value="#{msg.tilde_i}" />culo <span class="asterisco">*</span></label>
			<h:selectOneMenu id="idGrupoArticulo" value="#{articuloController.articulo.idGrupoArticuloStr}" styleClass="validate[required]">
				<f:selectItem itemLabel="Seleccione..." itemValue=""/>
				<f:selectItems value="#{articuloController.articuloGrupoSelectItems}" />
				<a4j:support event="onchange" reRender="articuloSubGrupoPanel" ajaxSingle="true" action="#{articuloController.checkSubGrupos}">
					<a4j:actionparam name="docIdTypeParam" value="document.getElementById('createArticuloForm:idGrupoArticulo').value" 
			                                          assignTo="#{articuloController.itemGrupo}" noEscape="true" />
				</a4j:support>
			</h:selectOneMenu>
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Sub Grupo Art<h:outputText value="#{msg.tilde_i}" />culo <span class="asterisco">*</span></label>
			<a4j:outputPanel id="articuloSubGrupoPanel">
			    <h:selectOneMenu id="idSubGrupoArticulo" value="#{articuloController.articulo.idSubGrupoArticuloStr}" styleClass="validate[required]">
			       <f:selectItem itemLabel="Seleccione..." itemValue=""/>
			       <f:selectItems value="#{articuloController.articuloSubGrupoSelectItems}"/>
			    </h:selectOneMenu>
			</a4j:outputPanel>
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label><h:outputText value="#{msg.tilde_A}" />rea responsable <span class="asterisco">*</span></label>
			<h:selectOneMenu id="idAreaResponsable" value="#{articuloController.articulo.idAreaResponsableStr}" styleClass="validate[required]">
				<f:selectItem itemLabel="Seleccione..." itemValue=""/>
				<f:selectItems value="#{articuloController.articuloAreaResponsableSelectItems}" />
			</h:selectOneMenu>
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Valor Unitario <span class="asterisco">*</span></label>
				<h:inputText id="valorUnitario" size="15" maxlength="15" styleClass="validate[required]"
						value="#{articuloController.articulo.valorUnitario}" />
		</span>
		<span class="left" style="margin-left:40px">
		<label>Unidad medida para la compra <span class="asterisco">*</span></label>
			<h:selectOneMenu id="idUnidadMedidaCompra" styleClass="validate[required]" value="#{articuloController.articulo.idUnidadMedidaCompraStr}">
            	<f:selectItem itemLabel="Seleccione..." itemValue=""/>
                <f:selectItems value="#{masterListCache.measureUnitType}"/>
            </h:selectOneMenu>
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Descripci<h:outputText value="#{msg.tilde_o}" />n para compra <span class="asterisco">*</span></label>
				<h:inputText id="descripcionCompra" size="60" maxlength="128" styleClass="validate[required]"
						value="#{articuloController.articulo.descripcionCompra}" />
		</span>
		<div class="clear" style="margin-left: 400px;"></div>
		<span class="left" style="margin-left:0px">
		<label>Tipo material <span class="asterisco">*</span></label>
			<h:selectOneMenu id="idTipoMaterial" styleClass="validate[required]" value="#{articuloController.articulo.idTipoMaterialStr}">
            	<f:selectItem itemLabel="Seleccione..." itemValue=""/>
                <f:selectItems value="#{masterListCache.elementOfFabricationType}"/>
            </h:selectOneMenu>
		</span>
		<span class="left" style="margin-left:40px">
		<label>Es de propiedad de la sub secretar<h:outputText value="#{msg.tilde_i}" />a?<span class="asterisco">*</span></label>
			<h:selectOneMenu id="propio" styleClass="validate[required]" value="#{articuloController.articulo.propio}">
            	<f:selectItem itemLabel="Seleccione..." itemValue=""/>
                <f:selectItem itemLabel="S#{msg.tilde_i}" itemValue="S"/>
                <f:selectItem itemLabel="No" itemValue="N"/>
            </h:selectOneMenu>
		</span>
		<span class="left" style="margin-left:40px">
		<label>Estado <span class="asterisco">*</span></label>
			<h:selectOneMenu id="estado" styleClass="validate[required]" value="#{articuloController.articulo.estado}">
            	<f:selectItem itemLabel="Seleccione..." itemValue=""/>
				<f:selectItem itemLabel="Activo" itemValue="ACTIVO"/>
				<f:selectItem itemLabel="Retirado" itemValue="RETIRADO"/>
            </h:selectOneMenu>
		</span>
		<div class="clear"></div>
		(<span class="asterisco"> * </span>) : Campo Obligatorio
		<div class="clear"></div>
		<span class="botones right">
		<h:commandButton id="createArticuloButton"
						 styleClass="botonsmall"
		                 type="submit" 
		                 value="Guardar" 
		                 ondblclick="return false;" 
		                 action="#{articuloController.create}" >
		</h:commandButton>
		</span>
</h:form>
		<span class="botones left">
		<h:form id="cleanArticuloForm">
		<h:commandButton id="cleanArticulodButton"
						 styleClass="botonsmall"
		                 type="submit" 
		                 value="Limpiar" 
		                 ondblclick="return false;" 
                         action="#{articuloController.createArticulo}" >
		</h:commandButton>		
		</h:form>
		</span>
</div>
<!-- Fin formulario --> 
<div class="clear"></div>
	<div>
		    <h:form id="cancelArticuloForm">
			<h:commandButton id="cancelCreateArticuloButton"
							 styleClass="botonsmall" 
                             type="submit" 
                             value="Cancelar" 
                             ondblclick="return false;" 
                             action="#{articuloController.cancelArticulo}" >
            </h:commandButton>
            </h:form>
	</div>
</div>
<div class="abajo-cuerpo"></div> <!-- Burrada pa ver borde redondo en IE -->
</div> <!-- Fin contenedor -->
<div class="footer"></div>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery-1.7.2.min.js"></script><!-- De ser 1ro -->
	<script src="<%=contextRoot%>/js/script.js" type="text/javascript"></script><!-- De ser 2do -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.uniform.min.js"></script> <!-- formularios -->
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=contextRoot%>/js/jquery/lib/jquery.validationEngine-es.js" type="text/javascript" charset="utf-8"></script>
    <script src="<%=contextRoot%>/js/jquery.maskedinput-1.3.js" type="text/javascript"></script>
	<script type="text/javascript">
		<!--
        jQ(document).ready(function() {
        	jQ("input, select, input:checkbox, input:radio, input:file").uniform();
        	jQ("#createArticuloForm").validationEngine('attach');
        	jQ("#createArticuloForm").bind("jqv.form.result", 
            	function(event, errorFound) {
        			if(!errorFound){ 
            			displayLoadingImage();
        			}
        		});
        	});
        //-->
    </script>
   	<%@ include file="include/validationStatus.jsp" %>
</body>
</html>
</f:view>
